<!DOCTYPE html>
<html>
<head>
<title>XSCHEM PROPERTIES</title>
<link rel="stylesheet" type="text/css" href="xschem_man.css" />
<style type="text/css">
/* Local styling goes here */
p{padding: 15px  30px 10px;}

</style>

</head>
<body>

<!-- start of slide -->
<div class="content">   
<!-- navigation buttons -->
<a href="building_xschem_symbol.html" class="prev">PREV</a>
<a href="xschem_man.html" class="home">UP</a>
<a href="component_instantiation.html" class="next">NEXT</a>
 <!-- slide title -->
 <h1>XSCHEM PROPERTIES</h1><br>
 <p>
  Properties are text strings that are associated to XSCHEM objects.
  All graphic primitives support properties.
 </p>
 <ul>
  <li>Wires</li>
  <li>Lines</li>
  <li>Polygons</li>
  <li>Rectangles</li>
  <li>Circles/Arcs</li>
  <li>Texts</li>
  <li>Symbol references</li>
  <li>Global attributes</li>
 </ul>
 <p>
  Consider for example the <kbd>res.sym</kbd> symbol
  (you may open it with the <kbd>File-&gt;Open</kbd> menu item)
  if you click inside one of the red pins and press the 'edit property'
  bindkey <kbd>'q'</kbd> a dialog box
  shows the property string associated with the selected pin:
 </p>
 <img src="edit_property.png">
 <p> 
  The <kbd>name=p&nbsp;dir=inout&nbsp;propag=1&nbsp;pinnumber=1</kbd> property string tells that the
  selected pin name is <kbd>'p'</kbd>,
  this will be the symbol positive pin name in the produced netlist.
  The property string also defines a <kbd>dir</kbd> attribute with value
  <kbd>inout</kbd>. This tells XSCHEM that electrically this is an input/output pin.
  This is important when producing VHDL/verilog netlists.
  The <kbd>propag=1</kbd> tells XSCHEM that when we select a wire attaced to this pin
  (which is located at index 0 in xschem) the highlight will propagate to the other pin (with index 1).
  To view the xschem index of a pin click and hold the mouse on it, the index will be shown as 
  <kbd>n= &lt;number&gt; </kbd> in the bottom status line:
 </p>
 <img src="edit_property2.png">
 <p>
  The <kbd> pinnumber=1</kbd> attribute is used when exporting to pcb software (via the tEDAx netlist) 
  and tells to which pin number on the resistor footprint this positive pin is bound.
  The second (bottom) pin property string is <kbd>name=m&nbsp;dir=inout&nbsp;propag=0&nbsp;pinnumber=2</kbd> and this
  defines the negative pin.
  The text primitives also have properties. For texts the property string may be used 
  to specify font and the layer to use for displaying text.
 </p>
 <img src="text_property.png">
 <h3>GLOBAL PROPERTIES</h3>
 <p>
  If you click outside of any displayed graphics in XSCHEM
  the selection set will be cleared.
  Clicking the edit property <kbd>'q'</kbd> key when nothing is
  selected will display the global property string of the
  schematic (.sch) or symbol window (.sym). 
  <p class="important">
  There is actually one different global property
  string defined for any available netlisting modes plus one global property string for symbol definition (file format 1.2), 
  so if XSCHEM is set to produce SPICE netlists the SPICE global property string is displayed.
  </p>
  <p>
  So, in addition to properties associated to graphical objects and
  symbols, we also have properties associated to schematic (.sch) and symbol files (.sym)
 </p>
 <img src="global_property.png">
 <p>
  In the above 'Symbol' global property string, the <kbd>format</kbd> attribute defines the format of the SPICE netlist. 
  The SPICE netlist element line starts with the 
  symbol name (in this case a resistor so 'rxxxxx'), the list of pins, the
  resistor value and a multiplicity factor (m).<br>
  <kbd>@pinlist</kbd> will resolve to the parent nets attached to the resistor 
  nodes, in the order they appear in the
  symbol (in this example; first node = 'p', second node = 'm').<br>
  We will return on component instantiation later, but for now,
  considering the following picture:
  </p>
  <img src="nets_pins.png"> 
  <p>
  The <kbd>@name</kbd> will expand to R0, <kbd>@pinlist</kbd> for the <kbd>R0</kbd> 
  component will expand to <kbd>POS&nbsp;NEG</kbd>.<br>
  <kbd>@value</kbd> resolves to the resistor value assigned in component instantiation.
  The <kbd>template</kbd> attribute defines default values if component
  instantiation does not define values for them.<br>
  If you want to add a pin to an existing symbol you may copy one
  of these. Select a pin, press the copy <kbd>'c'</kbd>
  bindkey and place a new copy of it somewhere.
 </p>
 <img src="place_pin.png" style="width: 90%;">
 <p>
  After copying the pin you may change its properties, for example you
  will change its property string to 
  something like: <kbd> name=body&nbsp;dir=in</kbd> (just as an example).<br>
  Note that pins in symbols are nothing more than rectangles
  drawn with the <kbd>pin</kbd> layer; instead of copying an
  existing one you may create it from scratch, select the pin
  layer from the <kbd>Layers</kbd> menu, point the mouse where
  you want to place the pin, press the <kbd>'r'</kbd> bindkey and drag the mouse
  to the desired pin size. There is no inherent limit or assumption
  on pin sizes, you are allowed to create any rectangular/square sizes. 
  After placing the rectangle you must create a property string by selecting it
  and pressing the <kbd>'q'</kbd> bindkey. An empty string is shown in the
  dialog. Add a valid string as explained and you are all done.
 </p>
 <h3> PIN ORDERING</h3>
 <p>
  An important aspect for symbols is the order of the pins
  when producing the netlist. There are some rules in the order
  for example in SPICE netlist syntax; for example a Bipolar transistor
  has 3 pins and should be in a specific order (collector, base, emitter).
  When done placing pins on a newly created symbol you can specify the order
  by selecting the one that must be the first in the netlist
  and hitting the <kbd>'&lt;shift&gt;S'</kbd>  bindkey; set the number to zero; 
  this will make the selected pin the first one. Next,
  select the second pin and again hit <kbd>'&lt;shift&gt;S'</kbd>,
  set its number to 1 and so on.
  By doing so you have defined a specific pin ordering of the symbol.
 </p>
 <img src="pin_order.png">

 <a id="prim_attrs">
 <h3> PRIMITIVE OBJECT PROPERTIES</h3></a>
 <p>
  The following attribute may be set on lines, arcs, polygons, rectangles:
  <ul>
  <li> <kbd>dash=n</kbd>, where n = integer. This specifies dashed mode drawing for the specified object.</li>
  </ul>
 </p>
 <p>
  The following attribute may be set on arcs, polygons, rectangles:
  <ul>
  <li> <kbd>fill=true</kbd>. This specifies to fill the object with the layer predefined fill style.
    The default for rectangles (for historical reasons) is to use fill style if not specified.
    For arcs and polygons the default is to not use fill if unspecified.</li>
  </ul>
 </p>
 <p>
  The following attribute may be set on rectangles and instances:
  <ul>
  <li> <kbd>lock=true</kbd> (or 1) can be set to disallow selecting the object.
    You always can double click on it to edit the attributes and reset lock to false (or 0).
    This is useful for title objects or frames you don't want to select while editing inside them.
  </ul>
 </p>
 <p>
  The following attribute may be set on wires and lines:
  <ul>
  <li> <kbd>bus=true</kbd>. This specifies to draw a wider line. Mostly used to display wire buses.</li>
  </ul>
 </p>
 <img src="dashes.png">



 <!-- end of slide -->
 <div class="filler"></div>
</div>

<!-- frame footer -->
<iframe seamless src="xschem_footer.html"  class="footer_iframe" >
</body>
</html>

